﻿namespace HEFramework
{
    public static class DeathComponentSystem
    {
        [EntitySystem]
        public class DeathComponentAwakeSystem : AwakeSystem<DeathComponent>
        {
            protected override void Awake(DeathComponent _self)
            {
            }
        }


        [EntitySystem]
        public class DeathComponentUpdateSystem : UpdateSystem<DeathComponent>
        {
            protected override void Update(DeathComponent _self)
            {
                AttributeComponent ac = _self.GetParentChild<AttributeComponent>();
                if (ac != null)
                {
                    if (ac.HP <= 0)
                    {
                        _self.Parent.Dispose();
                    }
                }
            }
        }
    }
}